package cn.com.coding.system.service.impl;

import cn.com.coding.common.utils.PageUtil;
import cn.com.coding.common.utils.Query;
import cn.com.coding.system.dao.UserCommentDao;
import cn.com.coding.system.domin.UserCommentEntity;
import cn.com.coding.system.service.UserCommentService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("userCommentService")
public class UserCommentServiceImpl extends ServiceImpl<UserCommentDao, UserCommentEntity> implements UserCommentService {

    @Override
    public PageUtil queryPage(Map<String, Object> params) {
        if (params.get("limit") != null) {
            params.put("limit", params.get("limit").toString());
        }
        if (params.get("page") != null) {
            params.put("page", params.get("page").toString());
        }
        IPage<UserCommentEntity> page = this.page(new Query<UserCommentEntity>().getPage(params),
                new QueryWrapper<UserCommentEntity>());

        return new PageUtil(page);
    }

}